package Boot.test.Controller;

import Boot.test.Dao.ServerBook;
import Boot.test.Domain.two;
import Boot.test.Server.Server;
import Boot.test.Server.ServerMongoDB;
import Boot.test.Utils.Mailbox;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;
import java.util.List;


@RestController
public class Controller {
    @Autowired
    Server serverBook;
    @Autowired
    RedisTemplate redisTemplate;
    @Autowired
    ServerMongoDB serverMongoDB;
    @GetMapping("/two")
    public String hello() throws MessagingException {
        List<two> id = serverBook.findId();
        redisTemplate.boundValueOps("name").set("1");
        System.out.println( redisTemplate.boundValueOps("name").get());
        System.out.println(id);
        List<two> twos = serverMongoDB.find();
        System.out.println(twos);
        Mailbox mailbox = new Mailbox();
//        mailbox.SendMailbox("375156486@qq.com","Login","111");
        return "2";
    }
}
